export default{
	state:{
		loginStatus:false,
		token:null,
		userInfo:{}
	},
	getters:{
		
	},
	mutations:{
		//读取本地信息:
		initUser(state){
			let userInfo =uni.getStorageSync('userInfo');
			if(userInfo){
				userInfo = JSON.parse(userInfo);
				state.userInfo = userInfo;
				state.loginStatus=true;
				state.token = userInfo.token;
				
			}
		},
		login(state,userInfo){
			state.userInfo = userInfo;
			state.loginStatus=true;
			state.token = userInfo.token;
			//本地存储:
			uni.setStorageSync('userInfo',JSON.stringify(userInfo))
		},
		outlgin(state){
			state.loginStatus=false;
			state.userInfo={};
			state.token=null;
			uni.removeStorageSync('userInfo');
		}
	},
	actions:{
		
	}
}